package java_test.collection;

import java.util.ArrayList;
import java.util.List;

public class BoxTG<T> {
    private T t;

    public T getT() {
        return t;
    }

    public void setT(T t) {
        this.t = t;
    }

    public static void main(String[] args) {
        BoxTG<Integer> integerBox = new BoxTG<Integer>();
        BoxTG<String> stringBox = new BoxTG<String>();

        integerBox.setT(new Integer(10));
        integerBox.setT(new Integer(11));
        stringBox.setT(new String("用友网络"));

        System.out.printf("整型值为 :%d\n\n", integerBox.getT());
        System.out.printf("字符串为 :%s\n", stringBox.getT());

        List<String> name = new ArrayList<String>();
        List<Integer> age = new ArrayList<Integer>();
        List<Number> number = new ArrayList<Number>();

        name.add("icon");
        age.add(18);
        number.add(314);

//        getUperNumber(name);//1
        getUperNumber(age);//2
        getUperNumber(number);//3

    }

    public static void getData(List<?> data) {
        System.out.println("data :" + data.get(0));
    }

    public static void getUperNumber(List<? extends Number> data) {
        System.out.println("data :" + data.get(0));
    }
}
